/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author flore_tchouanguem
 */
@Entity
@Table(name = "CategorieDocument")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CategorieDocument.findAll", query = "SELECT c FROM CategorieDocument c"),
    @NamedQuery(name = "CategorieDocument.findByIdCategorieDocument", query = "SELECT c FROM CategorieDocument c WHERE c.idCategorieDocument = :idCategorieDocument"),
    @NamedQuery(name = "CategorieDocument.findByLibelleCategorieDocument", query = "SELECT c FROM CategorieDocument c WHERE c.libelleCategorieDocument = :libelleCategorieDocument")})
public class CategorieDocument implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idCategorieDocument")
    private Integer idCategorieDocument;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "libelleCategorieDocument")
    private String libelleCategorieDocument;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "catDocument")
    private Collection<Document> documentCollection;

    public CategorieDocument() {
    }

    public CategorieDocument(Integer idCategorieDocument) {
        this.idCategorieDocument = idCategorieDocument;
    }

    public CategorieDocument(Integer idCategorieDocument, String libelleCategorieDocument) {
        this.idCategorieDocument = idCategorieDocument;
        this.libelleCategorieDocument = libelleCategorieDocument;
    }

    public Integer getIdCategorieDocument() {
        return idCategorieDocument;
    }

    public void setIdCategorieDocument(Integer idCategorieDocument) {
        this.idCategorieDocument = idCategorieDocument;
    }

    public String getLibelleCategorieDocument() {
        return libelleCategorieDocument;
    }

    public void setLibelleCategorieDocument(String libelleCategorieDocument) {
        this.libelleCategorieDocument = libelleCategorieDocument;
    }

    @XmlTransient
    public Collection<Document> getDocumentCollection() {
        return documentCollection;
    }

    public void setDocumentCollection(Collection<Document> documentCollection) {
        this.documentCollection = documentCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCategorieDocument != null ? idCategorieDocument.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CategorieDocument)) {
            return false;
        }
        CategorieDocument other = (CategorieDocument) object;
        if ((this.idCategorieDocument == null && other.idCategorieDocument != null) || (this.idCategorieDocument != null && !this.idCategorieDocument.equals(other.idCategorieDocument))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.entities.CategorieDocument[ idCategorieDocument=" + idCategorieDocument + " ]";
    }
    
}
